package com.example.mapper;

import com.example.domain.Device;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeviceMapper {

    @Select("select * from wmy.device")
    List<Device> getAll();

    @Select("select * from wmy.device where device_id = #{deviceId}")
    Device getById(Integer deviceId);

    @Insert("insert into wmy.device (device_name, device_type, device_status, device_data, device_updatetime) values (#{deviceName}, #{deviceType}, #{deviceStatus}, #{deviceData}, #{deviceUpdatetime})")
    boolean add(Device device);

    @Update("update wmy.device set device_name=#{deviceName},device_type=#{deviceType},device_status=#{deviceStatus},device_data=#{deviceData},device_updatetime=#{deviceUpdatetime}  where device_id = #{deviceId}")
    boolean update(Device device);

    @Delete("delete from wmy.device where device_id = #{deviceId}")
    boolean delete(Integer deviceId);

}
